package
{
	import Controller.KeyController;
	
	import Objects.ActionObject;
	
	import Scene.GameScene;
	
	import flash.display.Sprite;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	
	[SWF(width="1000", height="600", backgroundColor="#fffff", frameRate="30")]
	/**
	 * 游戏主类
	 * @author Jian 2011.03.08
	 */
	public class Main extends Sprite
	{
		
		public function Main():void
		{
			this.addEventListener(Event.ADDED_TO_STAGE,onStageStart);//监听stage生成
			
		}
		
		private function onStageStart(p_evt:Event):void
		{
			//stage.frameRate = 30;
			stage.scaleMode = StageScaleMode.SHOW_ALL;
			
			var scene:GameScene = new GameScene(stage); //声明游戏舞台
			var ctrl:KeyController = new KeyController();//定义控制器
			var obj:ActionObject = new ActionObject(ctrl);//定义可活动的游戏对象
			scene.addObject(obj);//将对象添加到舞台中
			
			//显示游戏舞台
			addChild(scene);
		}
		
	
	}
}